Dubbo报错:no provider available for the service

您所在的位置:网站首页 dubbo no provider available Dubbo报错:no provider available for the service

Dubbo报错:no provider available for the service

2024-07-10 05:51| 来源: 网络整理| 查看: 265

在整合dubbo开发项目的时候,服务端能正常启动,启动web端的时候,控制台报错:no provider available for the service 这是个比较头疼的问题,控制台报错如下

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-05-25 11:37:47.560 ERROR 1208 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'doctorController': Injection of @org.apache.dubbo.config.annotation.Reference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV. No provider available for the service medicalcloud/com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV from the url zookeeper://127.0.0.1:2181/org.apache.dubbo.registry.RegistryService?application=medicalcloud-consumer&default.timeout=20000&dubbo=2.0.2&group=medicalcloud&interface=com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV&methods=getDoctorByCondition,getDoctorDetail&pid=1208&qos.enable=false®ister.ip=192.168.0.103&release=2.7.0&side=consumer×tamp=1558755467501 to the consumer 192.168.0.103 use dubbo version 2.7.0 at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:132) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.quliankeji.medicalcloud.portal.PortalApplication.main(PortalApplication.java:16) Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV. No provider available for the service medicalcloud/com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV from the url zookeeper://127.0.0.1:2181/org.apache.dubbo.registry.RegistryService?application=medicalcloud-consumer&default.timeout=20000&dubbo=2.0.2&group=medicalcloud&interface=com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV&methods=getDoctorByCondition,getDoctorDetail&pid=1208&qos.enable=false®ister.ip=192.168.0.103&release=2.7.0&side=consumer×tamp=1558755467501 to the consumer 192.168.0.103 use dubbo version 2.7.0 at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:393) at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:301) at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:225) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.init(ReferenceAnnotationBeanPostProcessor.java:162) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.access$100(ReferenceAnnotationBeanPostProcessor.java:146) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:140) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildProxy(ReferenceAnnotationBeanPostProcessor.java:122) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:116) at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:49) at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.getInjectedObject(AnnotationInjectedBeanPostProcessor.java:340) at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor$AnnotatedFieldElement.inject(AnnotationInjectedBeanPostProcessor.java:520) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:128) ... 17 common frames omitted

选择重要的信息进行观察,Failed to check the status of the service com.quliankeji.medicalcloud.iservice.doctor.IDoctorSV,这里的意思就是这个Service接口创建失败, 后面的异常信息非常重要:No provider available for the service ,意思就是对于service来说,没有可实现的provider 消费者在访问提供者的时候失败了。

解决方案

Dubbo默认(缺省)会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止Spring初始化完成,以便上线时,能及早发现问题,默认check=true 如果你的Spring容器是懒加载的,或者通过API编程延迟引用服务,请关闭check,否则服务临时不可用时,会抛出异常,拿到null引用,如果check=false,总是会返回引用,当服务恢复时,能自动连上。 可以通过check=”false”关闭检查,比如,测试时,有些服务不关心,或者出现了循环依赖,必须有一方先启动。

关闭某个服务的启动时检查 关闭所有服务的启动时检查, 关闭注册中心启动时检查:(注册订阅失败时报错)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3